<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/interfaces/IMeasuresAccessDao.php';
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/interfaces/IConnectionAccessDao.php';
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/ConnectionFactory.php';
	
	error_reporting (E_ALL ^ E_NOTICE);
	
	$debug = $_SESSION['debug'];

  	class MySqlMeasuresAccessDao implements IMeasuresAccessDao {
  		/**
		 * Constructor of the measures dao
		 */
	 	public function __construct () {}
		
		/**
		 * Creates measures
		 */
     	public function createMeasures($measures) {
			$GLOBALS['debug']->log("Inicio Dao measures");
			$name = $measures -> getName();
			$number = $measures -> getNumber();
			$date = $measures -> getDate();
			$file = $measures -> getFile();


			
			$connection = ConnectionFactory :: getMySqlConnectionAccessDao();
			$conn = $connection -> openConnection();
			
				$query = "INSERT INTO MEASURES (name, number, date, file) VALUES ('$name', '$number','$date','$file')";
		
					
			$sentence = mysql_query($query, $conn);
		
			$GLOBALS['debug']->log("Query Dao measures"."  ".$query);
			if ($sentence)
			{
				return true;
					$GLOBALS['debug']->log("Fin Dao measures");
			}
			else
			{
			return false;
			}
	 	}
	 
	
	 
		 	 
	
		 

		 
  
  }


?>